<template>
  <div class="DetailNavBar">
    <nav-bar>
      <div class="navBack" slot="left" @click="navBackClick">
        <img src="~assets/img/common/back.svg" alt="">
      </div>
      <div class="titles" slot="center">
        <div
          class="titleItems"
          v-for="(item,index) in titles"
          :class="{isActived:currentIndex == index}"
          @click="itemsClick(index)"
        >
          {{ item }}
        </div>
      </div>
    </nav-bar>
  </div>
</template>

<script>
import NavBar from "@/components/common/navbar/NavBar";

export default {
  name: "DetailNavBar",
  components: {NavBar},
  data() {
    return {
      titles: ['商品', '参数', '评论', '推荐'],
      currentIndex: true
    }
  },
  methods: {
    itemsClick(index) {
      this.currentIndex = index
    },
    navBackClick() {
      this.$router.back()
    }
  }
}
</script>

<style scoped>
.DetailNavBar {
  background-color: #fff;
  height: 44px;
}

.DetailNavBar .titles {
  display: flex;
  font-size: 14px;
}

.DetailNavBar .titleItems {
  flex: 1;
}

.DetailNavBar .navBack img {
  margin-top: 10px;
}

.isActived {
  color: var(--color-high-text);
}
</style>
